package com.dzsw.poi;

import org.apache.poi.ss.usermodel.*;

import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class ShiftSample {

    public static void main(String[] args) {
        try (InputStream is = ShiftSample.class.getClassLoader().getResourceAsStream("original.xlsx");
             OutputStream os = new FileOutputStream("D:\\target.xlsx")) {
            Workbook wb = WorkbookFactory.create(is);
            Sheet sheet = wb.getSheetAt(0);
            sheet.shiftRows(1, 2, -1, true, true);
            wb.write(os);
        }catch(Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
